<?php $title='Fitness forum - add topic'; ?>
<?php include('fns_db_forum.php'); ?>
<?php include('../views/layouts/_header.php'); ?>
<?php include('../views/layouts/_left.php'); ?>
<?php if(!checkIfAdmin()){
		header("location: forum.php");
	} ?>

Adding new topic:<br/><br/>

<form name="form1" method="post" action="manage_forums.php?action=addTopic">

	<table width="600" border="0">
	  <tr>
	    <td>Topic: <input type="text" name="name"></td>
	  	<td>
		  	<?php
		  	$result = all_forums();

		  	if ($result == 0)
		  	{
		  		echo "<b>Error ";
		  		echo mysqli_errno($cxn).": ".mysqli_error($cxn);
		  		echo "</b>";
		  	}
		  	else
		  	{

		  		for( $i = 0; $i < mysqli_num_rows( $result ); $i++ )
		  		{
		  			$forum = mysqli_fetch_assoc( $result );

		  			printf ("<input name='id' type='radio' value='%s'>%s<br/>",$forum['id'], $forum['name']);
		  		}
		  	}
			?>
	  	</td>
	  </tr>
	</table>

	 <p>
	   <label>
	   <input name="submit" type="submit" id="submit" value="Add">
	   </label>
	</p>
</form>

<?php include('../views/layouts/_footer.php'); ?>